#include <sys/time.h>
#include "Graph.h"
#include "GraphLoader.h"

#include "hlss.h"
#include <string>
#include "Interval.h"


int main(int argc, char* argv[])
{
	if (argc < 2)
	{
		cout << "Usage: ./hlss filename" << endl << "Pls try again ;-)" << endl;
		return 0;
	}
	char* filename = argv[1];
	ifstream infile(filename);
	int query_size = 100000;
	if (infile == NULL)
	{
		cout << "ERR_01: File Can not be opened!" << endl;
		return -1;
	}
	Graph g;
	GraphLoader::readGraph(infile, g);
	cout << "---INPUT:---" << endl;
	cout << "File name: " << filename << endl;
	int node_count = num_vertices(g);
	cout << "Number of vertices: " << node_count  << "            Number of edges: " << num_edges(g) << endl;
	Timer timer;
	timer.start();
	hlss hl(g, node_count, NULL);
	hl.create_label();
	cout << "Index Construction time: " << timer.stop() << endl;
	timer.start();
	cout << endl << "ERROR: " << hl.batch_query(100000) << endl;
	cout << "Query Processing time: " << timer.stop() << endl;
	/*
	cout << endl << "HLSS Labeling is done, pls choose:" << endl;
	usage();
	string input;
	cout << "Input:";
	cin >> input;
	while (true)
	{
		if (input == "b")
		{
			ph.batch_query(query_size);
		}
		else if (input == "bfs")
		{
			ph.batch_query_bfs(query_size);
		}
		else if (input == "u")
		{
			ph.user_query();
		}
		else if (input == "q")
			break;
		else
			cout << "Invalid input!" << endl;
		cout << "Input:";
		cin >> input;
	}
	*/
	return 0;
}

